Add a patch to fix the new test-help.sh when ostree trivial-httpd is enabled
authorSimon McVittie <smcv@debian.org>
Fri, 15 Sep 2017 14:16:58 +0000 (15:16 +0100)
committerSimon McVittie <smcv@debian.org>
Fri, 15 Sep 2017 14:17:01 +0000 (15:17 +0100)
At the moment we still build that tool.

debian/changelog
debian/patches/Fix-test-help.sh-for-the-case-where-ostree-trivial-httpd-.patch [new file with mode: 0644]
debian/patches/series [new file with mode: 0644]

index 752ac181436a99f271f4282fd21e221260b88398..c271ff80a81c909ea7442780f3764ac06a5477a3 100644 (file)
@@ -7,6 +7,8 @@ ostree (2017.11-1) UNRELEASED; urgency=medium
     don't install it yet
   * Stop copying an old ostree-trivial-httpd.xml from debian/dist/
     into source tree. Upstream distributes it again.
+  * Add a patch to fix the new test-help.sh when ostree trivial-httpd
+    is enabled. At the moment we still build that tool.
 
  -- Simon McVittie <smcv@debian.org>  Wed, 30 Aug 2017 10:09:26 +0100
 
diff --git a/debian/patches/Fix-test-help.sh-for-the-case-where-ostree-trivial-httpd-.patch b/debian/patches/Fix-test-help.sh-for-the-case-where-ostree-trivial-httpd-.patch
new file mode 100644 (file)
index 0000000..1299772
--- /dev/null
@@ -0,0 +1,72 @@
+From: Simon McVittie <smcv@collabora.com>
+Date: Fri, 15 Sep 2017 15:15:43 +0100
+Subject: Fix test-help.sh for the case where ostree trivial-httpd is enabled
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: 8bit
+
+It's deprecated, but as long as it's still supported at all, it
+shouldn't make the tests fail.
+
+$ ostree trivial-httpd --help
+Usage:
+  /usr/lib/libostree/ostree-trivial-httpd [OPTION…] [DIR] - Simple webserver
+
+Signed-off-by: Simon McVittie <smcv@collabora.com>
+---
+ tests/test-help.sh | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/tests/test-help.sh b/tests/test-help.sh
+index 75fe0c1..2fda2c3 100755
+--- a/tests/test-help.sh
++++ b/tests/test-help.sh
+@@ -25,13 +25,13 @@ echo "1..1"
+ test_usage_output() {
+     file=$1; shift
+-    cmd=$1; shift
++    regex=$1; shift
+     assert_file_has_content $file '^Usage'
+     # check that it didn't print twice somehow
+     if [ "$(grep --count '^Usage' $file)" != 1 ]; then
+       _fatal_print_file "$file" "File '$file' has '^Usage' more than once."
+     fi
+-    assert_file_has_content $file "$cmd"
++    assert_file_has_content $file "$regex"
+ }
+ # check that we found at least one command with subcommands
+@@ -42,8 +42,13 @@ test_recursive() {
+     echo "$cmd" 1>&2
+     $cmd --help 1>out 2>err
++
++    # Usage for "ostree foo" can contain either "ostree foo" or "ostree-foo"
++    # (the latter for ostree trivial-httpd)
++    regex="${cmd/ostree /ostree[- ]}"
++
+     # --help message goes to standard output
+-    test_usage_output out "$cmd"
++    test_usage_output out "$regex"
+     assert_file_empty err
+     builtins=`sed -n '/^Builtin \("[^"]*" \)\?Commands:$/,/^$/p' <out | tail -n +2`
+@@ -60,7 +65,7 @@ test_recursive() {
+         fi
+         # error message and usage goes to standard error
+-        test_usage_output err "$cmd"
++        test_usage_output err "$regex"
+         assert_file_has_content err 'No \("[^"]*" sub\)\?command specified'
+         assert_file_empty out
+@@ -70,7 +75,7 @@ test_recursive() {
+             assert_not_reached "non-existent subcommand but 0 exit status"
+         fi
+-        test_usage_output err "$cmd"
++        test_usage_output err "$regex"
+         assert_file_has_content err 'Unknown \("[^"]*" sub\)\?command'
+         assert_file_empty out
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644 (file)
index 0000000..913d54e
--- /dev/null
@@ -0,0 +1 @@
+Fix-test-help.sh-for-the-case-where-ostree-trivial-httpd-.patch